solve :: (Float, Float) -> Int
solve (x, y) = sqrtY - sqrtX
    where sqrtX = floor $ sqrt x
          sqrtY = floor $ sqrt y

listToTuple :: [String] -> (Float, Float)
listToTuple (x1:x2:[]) = (read x1, read x2)

main = do
    c <- getLine --readFile "D:\\jcglopes-hacker-rank\\Domains\\Algorithms\\Warmup\\sherlock-and-squares\\input04.txt"
    let ls = lines c
        ns = map listToTuple $ map words ls
        solution = map solve ns
    putStrLn $ unlines $ map show solution
--"D:\\jcglopes-hacker-rank\\Domains\\Algorithms\\Warmup\\sherlock-and-squares\\generated_output04.txt"     